<main class="app-content">
    <div class="row">
        <div class="col-md-12">
            <div class="imgPreview"><img src="#" alt="" id="imgPreview">
            </div>
            <div class="bs-component">
                <div class="card">
                    <h2 class="card-header">
                        <div class="form-check-inline">
                            <button type="button" class="btn btn-danger"
                                    onclick="delete_and_close('/domain-delete','{{ .domain_info.Id }}')"><i
                                    class="fa fa fa-trash-o"></i>
                            </button>&nbsp;
                            <button type="button" id="btn_switchShowFofa" class="btn btn-secondary"
                                    onclick="refresh_info('domain','{{ .domain_info.Workspace }}','{{ .domain_info.Domain }}',{{ .domain_info.DisableFofa }})">
                                <i class="fa fa-info-circle"></i>{{ if .domain_info.DisableFofa }}
                                显示FOFA/Quake/Hunter/0Zone信息
                                {{ else }}
                                不看FOFA/Quake/Hunter/0Zone信息
                                {{ end }}
                            </button>&nbsp;
                            <button type="button" id="btn_switchPin" class="btn btn-secondary"
                                    onclick="pin_top_info('domain','{{ .domain_info.Id }}','{{ .domain_info.PinIndex }}')">
                                {{ if eq .domain_info.PinIndex "1" }}
                                <i class="fa fa-thumb-tack"></i>取消置顶
                                {{ else }}
                                <i class="fa fa-thumb-tack fa-rotate-90"></i>置顶
                                {{ end }}
                            </button>
                            &nbsp;
                            <button type="button" id="btn_editDomainMemo" class="btn btn-secondary"><i
                                    class="fa fa-pencil-square-o"></i>编辑备忘录
                            </button>&nbsp;
                            <div class="dropdown">
                                <button class="btn btn-secondary dropdown-toggle" type="button"
                                        id="dropdownMenuButton"
                                        data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i
                                        class="fa fa-tags"></i>
                                    标记颜色
                                </button>
                                &nbsp;
                                <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                                    <a class="dropdown-item bg-danger"
                                       href="javascript:mark_domain_color_tag({{ .domain_info.Id }},'badge-danger')">RED</a>
                                    <a class="dropdown-item bg-warning"
                                       href="javascript:mark_domain_color_tag({{ .domain_info.Id }},'badge-warning')">YELLOW</a>
                                    <a class="dropdown-item bg-info"
                                       href="javascript:mark_domain_color_tag({{ .domain_info.Id }},'badge-info')">BLUE</a>
                                    <a class="dropdown-item bg-success"
                                       href="javascript:mark_domain_color_tag({{ .domain_info.Id }},'badge-success')">GREEN</a>
                                    <a class="dropdown-item bg-secondary"
                                       href="javascript:mark_domain_color_tag({{ .domain_info.Id }},'badge-secondary')">GRAY</a>
                                    <a class="dropdown-item bg-dark"
                                       href="javascript:mark_domain_color_tag({{ .domain_info.Id }},'badge-dark')">BLANK</a>
                                    <a class="dropdown-item  bg-white"
                                       href="javascript:mark_domain_color_tag({{ .domain_info.Id }},'DELETE')">清除标记</a>
                                </div>
                            </div>
                            {{ if .domain_info.ColorTag }}
                            <a href="http://{{ .domain_info.Domain }}"
                               class="badge {{ .domain_info.ColorTag }}"
                               target="_blank">{{ .domain_info.Domain }}</a>
                            {{ else }}
                            <a href="http://{{ .domain_info.Domain }}"
                               target="_blank">{{ .domain_info.Domain }}</a>
                            {{ end }}
                        </div>
                    </h2>
                    <div class="card-body">
                        <span class="btn btn-info">关联IP</span></b>
                        <span class="btn btn-warning text-left">
                            {{ range .domain_info.IP }}
                                <a href="ip-info?workspace={{ $.domain_info.Workspace }}&&ip={{ . }}" target="_blank">{{ . }}</a>&nbsp;
                            {{ end }}
                        </span>
                        <span class="btn btn-info">端口信息</span></b>
                        <span class="btn btn-warning  text-left">{{ .domain_info.Port }}</span>
                        {{ if or .domain_info.TitleString .domain_info.BannerString }}
                        <br><br>
                        <span class="btn btn-info">站点标题</span></b>
                        <span style="margin: 10px;"><strong>{{.domain_info.TitleString }}</strong></span>
                        {{ end }}
                        {{ if .domain_info.Banner }}
                        <span class="btn btn-info">Banner</span></b>
                        <span style="margin: 10px;"><strong>{{.domain_info.BannerString }}</strong></span>
                        {{ end }}
                        {{ if .domain_info.IconHashes }}
                        <span class="btn btn-info">IconHash</span>
                        {{ range .domain_info.IconHashes }}
                        <a href="{{ .FofaUrl }}" target="_blank"><img
                                src="/webfiles/{{ $.domain_info.WorkspaceGUID }}/iconimage/{{ .IconImage }}"
                                height="24px" width="24px"
                                title="{{ .IconHash }}"/></a>&nbsp;
                        {{ end }}
                        {{ end }}
                        {{ if .domain_info.TlsData }}
                        <span class="btn btn-info">TLS</span>
                        <span style="margin: 10px;"><strong>{{ .domain_info.TlsData }}</strong></span>
                        {{ end }}
                        <br><br>
                        {{ if .domain_info.Organization }}
                        <span class="btn btn-info">所属组织</span></b>
                        <span class="btn border-success">{{ .domain_info.Organization }}</span>
                        {{ end }}
                        <span class="btn btn-info">创建时间</span></b>
                        <span class="btn border-success">{{ .domain_info.CreateTime }}</span>
                        <span class="btn btn-info">更新时间</span></b>
                        <span class="btn border-success">{{ .domain_info.UpdateTime }}</span>
                        {{ if .domain_info.Screenshot }}
                        <p></p>
                        <p>
                            <button class="btn btn-info" type="button" data-toggle="collapse"
                                    data-target="#collapseScreenShot" aria-expanded="false"
                                    aria-controls="collapseScreenShot">
                                ScreenShot
                            </button>
                        </p>
                        <div class="collapse.show" id="collapseScreenShot">
                            <div id="screenshot_content" class="card card-body">
                                <div>
                                    {{ range .domain_info.Screenshot }}
                                    <img src="{{ .ScreenShotThumbnailFile }}" class="img" width="120"
                                         style="display: block;float: left;margin-right: 5px;"
                                         onclick=show_bigpic({{ .ScreenShotFile }}) title="{{ .Tooltip }}"/>
                                    {{ end }}
                                </div>
                            </div>
                        </div>
                        {{ end }}

                        {{ if or .domain_info.Memo .domain_info.Vulnerability .domain_info.WikiDocs }}
                        <p></p>
                        <ul class="nav nav-tabs" id="myTab">
                            {{ if .domain_info.Memo }}
                            <li class="nav-item active"><a class="nav-link active" data-toggle="tab"
                                                           href="#menu1">Memo</a></li>
                            {{ end }}
                            {{ if .domain_info.WikiDocs }}
                            <li class="nav-item"><a class="nav-link" data-toggle="tab" href="#menu2">Wiki</a></li>
                            {{ end }}
                            {{ if .domain_info.Vulnerability }}
                            <li class="nav-item"><a class="nav-link" data-toggle="tab" href="#menu3">Vulnerability</a>
                            </li>
                            {{ end }}
                        </ul>
                        <div class="tab-content" id="myTabContent">
                            {{ if .domain_info.Memo }}
                            <div id="menu1" class="tab-pane fade show active">
                                <div class="card card-body">
                                    <pre>{{.domain_info.Memo }}</pre>
                                </div>
                            </div>
                            {{ end }}
                            {{ if .domain_info.WikiDocs }}
                            <div id="menu2" class="tab-pane fade ">
                                <table class="table table-bordered">
                                    <thead>
                                    <tr class="alert-dark">
                                        <th width="35%">标题</th>
                                        <th width="25%">备注</th>
                                        <th width="15%">更新时间</th>
                                        <th width="15%">创建时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {{ range .domain_info.WikiDocs}}
                                    <tr>
                                        <td>
                                            <a href="https://nqmgg3xrjzi.feishu.cn/wiki/{{ .NodeToken }}"
                                               target="{{ .NodeToken }}">{{ .Title }}</a>
                                        </td>
                                        <td>{{ .Comment }}</td>
                                        <td>{{ .UpdateTime }}</td>
                                        <td>{{ .CreateTime }}</td>
                                    </tr>
                                    {{ end }}
                                    </tbody>
                                </table>
                            </div>
                            {{ end }}
                            {{ if .domain_info.Vulnerability }}
                            <div id="menu3" class="tab-pane fade  ">
                                <table class="table table-bordered">
                                    <thead>
                                    <tr class="alert-dark">
                                        <th width="10%">Target</th>
                                        <th width="25%">URL</th>
                                        <th width="35%">Poc File</th>
                                        <th width="10%">Source</th>
                                        <th width="15%">更新时间</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {{ range .domain_info.Vulnerability}}
                                    <tr>
                                        <td>{{ .Target }}</td>
                                        <td>{{ .Url }}</td>
                                        <td>
                                            <a href="vulnerability-info?id={{ .Id }}" target="_blank">{{ .PocFile }}</a>
                                        </td>
                                        <td>{{ .Source }}</td>
                                        <td>{{ .UpdateTime }}</td>
                                    </tr>
                                    {{ end }}
                                    </tbody>
                                </table>
                            </div>
                            {{ end }}
                        </div>
                        {{ end }}

                    </div>
                    <div class="card-footer text-muted">
                        <button class="btn btn-secondary" type="button" data-toggle="collapse"
                                data-target="#collapseDomainAttr" aria-expanded="false"
                                aria-controls="collapseDomainAttr">
                            域名相关信息
                        </button>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <div class="tile">
                {{ if .domain_info.DomainAttr }}
                <div class="collapse.show" id="collapseDomainAttr">
                    <table class="table table-bordered">
                        <thead>
                        <tr class="alert-dark">
                            <th width="8%">属性</th>
                            <th width="50%">内容</th>
                            <th width="8%">创建时间</th>
                            <th width="8%">更新时间</th>
                            <th width="5%">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {{ range .domain_info.DomainAttr }}
                        <tr>
                            <td>
                                {{ if eq .Tag "http_header" }}
                                http_header<br/> {{ .Port }} <a
                                    href="javascript:show_http_content('domain',{{ .DomainId }},{{ .Port }})">
                                <i class="fa fa-file-code-o" title="网站正文"></i></a>
                                {{ else }}
                                {{ .Tag }}
                                {{ end }}
                            </td>
                            <td>
                                {{ if eq .Tag "http_header" }}
                                <div style="width:100%;white-space:normal;word-wrap:break-word;word-break:break-all;">
                                    <pre>{{ .Content }}</pre>
                                </div>
                                {{ else }}
                                <div id="div_domainattr"
                                     style="width:100%;white-space:normal;word-wrap:break-word;word-break:break-all;">
                                    {{ .Content }}
                                </div>
                                {{ end }}
                            </td>
                            <td>{{ .CreateTime }}</td>
                            <td>{{ .UpdateTime }}</td>
                            <td>
                                {{ if eq .Tag "OnlineAPI" }}
                                <a class="btn btn-sm btn-danger"
                                   href="javascript:delete_domain_onlineapi_attr({{ .Id }})"
                                   role="button" title="Delete"><i class="fa fa-trash-o"></i></a>
                                {{ else if eq .Tag "ICP" "Whois" "http_header" }}
                                &nbsp;
                                {{ else }}
                                <a class="btn btn-sm btn-danger" href="javascript:delete_domain_attr({{ .Id }})"
                                   role="button" title="Delete"><i class="fa fa-trash-o"></i></a>
                                {{ end }}
                            </td>
                        </tr>
                        {{ end }}
                        </tbody>
                    </table>
                </div>
                {{ end }}
                {{ if .domain_info.PortAttr }}
                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <th width="8%">IP地址</th>
                        <th width="5%">端口</th>
                        <th width="5%">来源</th>
                        <th width="5%">属性</th>
                        <th width="30%">内容</th>
                        <th width="8%">创建时间</th>
                        <th width="8%">更新时间</th>
                        <th width="5%">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {{ range .domain_info.PortAttr }}
                    {{ if .TableBackgroundSet }}
                    <tr class="alert-dark">
                        {{ else }}
                    <tr>
                        {{ end }}
                        <td>
                            {{ .IP }}
                        </td>
                        <td>
                            {{ if and .IP .Port }}
                            {{ if eq .Port "443" "8443" }}
                            <a href="https://{{.IPFormatted}}:{{.Port}}" target="_blank">{{.Port}}</a>
                            {{ else }}
                            <a href="http://{{.IPFormatted}}:{{.Port}}" target="_blank">{{.Port}}</a>
                            {{ end }}
                            {{ else }}
                            {{ .Port }}
                            {{ end }}
                        </td>
                        <td>
                            {{ if eq .Source "portscan" }}
                            <span class="badge badge-warning"> {{ .Source }}</span>
                            {{ else if eq .Source "fofa" }}
                            {{ if .FofaLink }}
                            <a href="{{ .FofaLink }}" target="_blank"><span
                                    class="badge badge-success">  {{ .Source }} </span></a>
                            {{ else }}
                            <span class="badge badge-success"> {{ .Source }}</span>
                            {{end }}
                            {{ else if eq .Source "hunter" "quake" "0zone" }}
                            <span class="badge badge-success"> {{ .Source }}</span>
                            {{ else if eq .Source "iconhash" }}
                            <span class="badge badge-dark"> {{ .Source }}</span>
                            {{ else if eq .Source "ObserverWard" "httpxfinger" }}
                            <span class="badge badge-danger"> {{ .Source }}</span>
                            {{ else }}
                            <span class="badge badge-secondary"> {{ .Source }}</span>
                            {{ end }}
                        </td>
                        <td>
                            {{ if eq .Tag "http_header" }}
                            http_header<br/><a href="javascript:show_http_content('ip',{{ .PortId }})"><i
                                class="fa fa-file-code-o" title="网站正文"></i></a>
                            {{ else }}
                            {{ .Tag }}
                            {{ end }}
                        </td>
                        <td>
                            {{ if eq .Tag "http_header" }}
                            <div style="width:100%;white-space:normal;word-wrap:break-word;word-break:break-all;">
                                <pre>{{ .Content }}</pre>
                            </div>
                            {{ else }}
                            <div id="div_content"
                                 style="width:100%;white-space:normal;word-wrap:break-word;word-break:break-all;">
                                {{ .Content }}
                            </div>
                            {{ end }}
                        </td>
                        <td>{{ .CreateTime }}</td>
                        <td>{{ .UpdateTime }}</td>
                        <td>
                            {{ if eq .Tag "http_header" }}
                            &nbsp;
                            {{ else }}
                            <a class="btn btn-sm btn-danger" href="javascript:delete_port_attr({{ .Id }})"
                               role="button" title="Delete"><i class="fa fa-trash-o"></i></a>
                            {{ end }}
                        </td>
                    </tr>
                    {{ end }}
                    </tbody>
                </table>
                {{ end }}
            </div>
        </div>
    </div>
    <!--row-->
</main>
<!-- 模态对话框：编辑备忘录-->
<div class="modal fade" id="editMemo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header card-header bg-primary">
                <h4 class="modal-title" id="myModalLabel">
                    编辑备忘录
                </h4>
            </div>
            <div class="modal-body ">
                <form class="form-horizontal" role="form">
                    <div class="form-group">
                            <textarea class="form-control" id="text_content" rows="15"
                                      placeholder="输入备忘录信息..."></textarea>
                    </div>
                    <input type="hidden" id="r_id" value="{{ .domain_info.Id }}"/>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal" aria-hidden="true">取消
                </button>
                <button class="btn btn-primary org-update" type="button" id="btn_saveDomainMemo">
                    保存
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div> <!-- table responsive-->
<!-- 模态对话框：显示网站正文-->
<div class="modal fade" id="showHttpInfo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2"
     aria-hidden="true">
    <div class="modal-dialog" style="max-width: 1024px;">
        <div class="modal-content">
            <div class="modal-header card-header bg-primary">
                <h4 class="modal-title" id="myModalLabel2">
                    网站正文
                </h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" role="form">
                    <div class="form-group">
                        <textarea class="form-control" id="text_content_http" rows="20"
                                  placeholder="网站正文"></textarea>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal" aria-hidden="true">关闭
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div> <!-- table responsive-->
<script src="static/js/jquery/jquery-3.3.1.min.js"></script>
<script src="static/js/bootstrap/popper.min.js"></script>
<script src="static/js/bootstrap/bootstrap.min.js"></script>
<script src="static/js/main.js"></script>
<script src="static/js/plugins/pace.min.js"></script>
<!-- Data table plugin-->
<script src="static/js/plugins/jquery.dataTables.min.js"></script>
<script src="static/js/plugins/dataTables.bootstrap.min.js"></script>
<script src="static/js/sweetalert/sweetalert.min.js"></script>
<script src="static/js/jquery/jquery.bootstrap-duallistbox.js"></script>
<script src="static/js/server/asset-info.js"></script>
<script>
    $("title").html(" {{ .domain_info.Domain }}-domaininfo");
    $('#myTab a:first').tab('show');
</script>
